import { Event_Name, GEventManager } from "../../UIFrame/GEventManager";
import SoundManager from "../../UIFrame/SoundManager";
import UIManager from "../../UIFrame/UIManager";

const { ccclass, property } = cc._decorator;

@ccclass
export default class MainScene extends cc.Component {

    onLoad() {
        UIManager.getInstance().openUIForm('prefabs/UIForms/HallUI');
    }

    onEnable(){
        GEventManager.on(Event_Name.GAME_PLAY_SOUNDS,this.playSounds,this);
    }

    start() {
        SoundManager.getInstance().init();
        SoundManager.getInstance().playMusic('sounds/bgm');
    }

    playSounds(url){
        SoundManager.getInstance().playEffect(url);
    }

    onDisable(){
        GEventManager.off(Event_Name.GAME_PLAY_SOUNDS,this.playSounds,this);
    }
}
